import request from '@/utils/request';
import type { BaseTreeModel, ResponseBaseData } from '@/api/model/baseModel';
export const basePath = '/appsys/ConnectCenter/AppConnectCenterRest';

/** sys_cc_classic */
export interface SysCcClassicDto extends BaseTreeModel {
  /** 名字 */
  name?: string;
  /** 编码 */
  code?: string;
  /** 排序 */
  orderBy?: number | string;
  /** 多行文本 */
  description?: string;
  /** 父id */
  parentId?: any;
  /** ATTRIBUTE_01 */
  attribute01?: string;
  /** ATTRIBUTE_02 */
  attribute02?: string;
  /** ATTRIBUTE_03 */
  attribute03?: string;
  /** ATTRIBUTE_04 */
  attribute04?: string;
  /** ATTRIBUTE_05 */
  attribute05?: string;
  /** ATTRIBUTE_06 */
  attribute06?: string;
  /** ATTRIBUTE_07 */
  attribute07?: string;
  /** ATTRIBUTE_08 */
  attribute08?: string;
  /** ATTRIBUTE_09 */
  attribute09?: string;
  /** ATTRIBUTE_10 */
  attribute10?: string;
}

/** 获取树数据 */
export function getTreeData() {
  return request.get(`${basePath}/getConnectTypeTree/-1/v1`);
}

/**
 * 根据id加载数据
 * @param id 选中行id
 * @returns 表单数据
 */
export function getSysCcClassic(id: string): Promise<ResponseBaseData<SysCcClassicDto>> {
  return request.get(`${basePath}/get/${id}/v1`);
}

/**
 * 保存表单数据
 * @param form 表单数据
 */
export function saveSysCcClassic(form: SysCcClassicDto): Promise<ResponseBaseData<any>> {
  return request.post(`${basePath}/insertConnectType/v1`, form);
}
/**
 * 编辑保存表单数据
 * @param form 编辑表单数据
 */
export function editSaveSysCcClassic(form: SysCcClassicDto): Promise<ResponseBaseData<any>> {
  return request.post(`${basePath}/updateConnectType/v1`, form);
}

/**
 * 根据id集合删除数据
 * @param id 选中行id
 */
export function delSysCcClassic(id: string): Promise<ResponseBaseData<any>> {
  return request.delete(`${basePath}/deleteConnectTypeById/${id}/v1`);
}
